class Solution(object):
    def plusOne(self, digits):
        """
        :type digits: List[int]
        :rtype: List[int]
        """
        # method 1
        # a = [i * 10 ** index for index, i in enumerate(digits[::-1])]
        # num = sum(a) + 1
        # return [int(x) for x in str(num)]

        # method 2
        for i in range(len(digits)-1, -1, -1):
            if digits[i] != 9:
                digits[i] += 1
                return digits
            else:
                digits[i] = 0
                if digits[0] == 0:
                    digits.insert(0, 1)    #针对于【9】这种情况
                    return digits

def main():
    digits = input('digits = ')
    Solution().plusOne(digits)

if __name__ == '__main__':
    main()

